extends 基础弹窗类

@onready var line_edit = $MarginContainer/VBoxContainer/HBoxContainer2/LineEdit

var core = null

func _初始化(_data):
	line_edit.set_text(str(core.player_status["cash"]))

func _ready():
	core = GameCore
	var confirm_button = $MarginContainer/VBoxContainer/HBoxContainer3/Button
	confirm_button.pressed.connect(func():self._confirm())
	var cancel_button = $MarginContainer/VBoxContainer/HBoxContainer3/Button2
	cancel_button.pressed.connect(func():self._cancel())


func _confirm():
	assert(core != null, "Error: game core is undefined.")
	core.deposit_money_to_bank(line_edit.get_text() as int)
	关闭()
	GameViewManager.关闭弹窗("银行")
	
func _cancel():
	关闭()
